package com.gcb.domain.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class RegionVO implements Serializable {

    private static final long serialVersionUID = 1L;

    private String name;
    private String code;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private List<RegionVO> child;

    public RegionVO() {
    }

    public RegionVO(String name, String code) {
        this.name = name;
        this.code = code;
        this.child = null;
    }

    public void addChild(RegionVO regionVO) {
        if (this.child == null) {
            this.child = new ArrayList<>();
        }
        this.child.add(regionVO);
    }
}
